layui.use(['layer','table','form'], function(args){
    var layer = layui.layer;

});

function del(id) {
    if (id) {
        var loadIndex = layer.load(2);
        $.ajax({
            url: 'instance/delete.do',
            data: {id: id},
            dataType: 'json',
            success: function (data, textStatus) {
                layer.close(loadIndex);
                layer.alert(data.message,function (index) {
                    layer.close(index);
                    if (data.success) {
                        location.reload();
                    }
                });
            }
        });
    } else {
        layer.alert("id为空")
    }
}
/**
 *挂起或激活流程
 * @param id 流程定义ID
 * @param suspendOrActivate 挂起还是激活，suspend挂起，activate激活
 * @return
 */
function suspendOrActivate(id,suspendOrActivate) {
    var loadIndex = layer.load(2);
    $.ajax({
        url: 'instance/suspendOrActivate.do',
        data: {processInstanceId: id,suspendOrActivate:suspendOrActivate},
        type:'get',
        dataType: 'json',
        success: function (data, textStatus) {
            layer.close(loadIndex);
            layer.alert(data.message,function (index) {
                layer.close(index);
                if (data.success) {
                    location.reload();
                }
            });
        }
    });
}